import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Log from '@/components/login'
import Home from '@/components/home'
import Department from '@/components/Department'
import homePage from '@/components/homePage'
import toRegist from '@/components/toRegist'


const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}
Vue.use(Router)
export default new Router({
  routes: [
    {
      path: '/',
      name: 'log',
      component: Log
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      children:[
        
        {
          path: '/homePage',
          name: 'homePage',
          component: homePage
        },
        {
          path: '/userCtrl',
          name: 'userCtrl',
          component: HelloWorld
        },
        {
          path: '/departmentCtrl',
          name: 'departmentCtrl',
          component: Department
        }
      ]
    },
    {
      path: '/toRegist',
      name: 'toRegist',
      component: toRegist
    }
  ]
  
})
